package cn.bugDance.domain.strategy.model.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class StrategyAwardEntity {
    private Long strategyId;

    private Integer awardId;

    /**
     * 奖品级规则
     */
    private String awardTitle;

    private String awardSubTitle;

    private Integer awardCount;

    private Integer awardCountSurplus;

    private BigDecimal awardRate;

    /**
     * 1. rule_luck_award 奖品库存不足, 提供兜底奖励
     * 2. rule_lock 奖品需要抽奖次数达标解锁
     * 3. rule_stock 奖品有库存限制
     */
    private String ruleModels;

    private Integer sort;

    /**
     * 是否加入抽奖概率计算
     * 0 加入
     * 1 不加入
     */
    private Integer raffle;

    public List<String> ruleModels(){
        String[] ruleModelsArr = ruleModels.split(",");
        if(ruleModelsArr.length == 0) return null;
        List<String> ruleModelsList = new ArrayList<>(Arrays.asList(ruleModelsArr));
        return ruleModelsList;
    }
}
